/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package dp_map;

import java.util.*;
/**
 *
 * @author Carlos
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        //Map mapita = new Map();

        TreeMap treemap = new TreeMap<Objeto, String>(new Comparador());
        TreeMap tmap = new TreeMap<String, Objeto>();

        
        Objeto a = new Objeto(1, "Uno");
        Objeto b = new Objeto(2, "Dos");
        Objeto c = new Objeto(3, "Tres");
        Objeto d = new Objeto(4, "Cuatro");
        Objeto e = new Objeto(5, "Cinco");
        Objeto f = new Objeto(6, "Seis");

        /*
        treemap.put(6, f);
        treemap.put(4, d);
        treemap.put(1, a);
        treemap.put(3, c);
        treemap.put(2, b);
        treemap.put(5, e);
        */

        
        treemap.put(f, 6);
        treemap.put(d, 4);
        treemap.put(a, 1);
        treemap.put(c, 3);
        treemap.put(b, 2);
        treemap.put(e, 5);
        

/*
        Objeto r = new Objeto();
        r = (Objeto)treemap.get("One");

        System.out.println(treemap.get("One"));
        System.out.println(((Objeto)treemap.get("One")).entero);
        System.out.println(((Objeto)treemap.get("One")).cad);
        System.out.println(r.entero);
        System.out.println(r.cad);
*/

        //for (Iterator iterator=treemap.values().iterator();iterator.hasNext(); ) {
        //    System.out.println(((Objeto)iterator.next()).entero);
            //System.out.println(((Objeto)iterator.next()).cad);
        //}

        System.out.println(treemap);
        
        Iterator it = treemap.entrySet().iterator();
        while (it.hasNext()) {
            Map.Entry x = (Map.Entry)it.next();
            System.out.println(((Objeto)x.getKey()).entero + " " + x.getValue());
            System.out.println(((Objeto)x.getKey()).cad + " " + x.getValue());
        }
        
    }

}
